<template>
    <el-form :model="wBangForm" status-icon :rules="rules" ref="wBangForm"
             label-width="150px"
             style="margin-top: 10px;color: #1f2d3d">
        <el-form-item class="form-label" label="水厂名称" prop="name">
            <el-col :span="19">
                <el-input v-model="wBangForm.name" placeholder="水厂名称"
                          maxlength="11" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="经度" prop="longitude">
            <el-col :span="19">
                <el-input v-model="wBangForm.longitude" placeholder="经度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="经度" prop="latitude">
            <el-col :span="19">
                <el-input v-model="wBangForm.latitude" placeholder="经度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="建筑物编码" prop="bid">
            <el-col :span="19">
                <el-input v-model="wBangForm.bid" placeholder="建筑物编码"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="建筑物名称" prop="buildingName">
            <el-col :span="19">
                <el-input v-model="wBangForm.buildingName" placeholder="建筑物名称"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="结构类型" prop="type">
            <el-col :span="19">
                <el-input v-model="wBangForm.type" placeholder="结构类型"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="建筑层数" prop="floors">
            <el-col :span="19">
                <el-input v-model="wBangForm.floors" placeholder="建筑层数"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="建筑面积" prop="area">
            <el-col :span="19">
                <el-input v-model="wBangForm.area" placeholder="建筑面积"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="混凝土等级" prop="material">
            <el-col :span="19">
                <el-input v-model="wBangForm.material" placeholder="混凝土等级"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="砖砌体标号" prop="materialType">
            <el-col :span="19">
                <el-input v-model="wBangForm.materialType" placeholder="砖砌体标号"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="场地类型" prop="site">
            <el-col :span="19">
                <el-input v-model="wBangForm.site" placeholder="场地类型"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="6度时液化程度" prop="liquefaction6">
            <el-col :span="19">
                <el-input v-model="wBangForm.liquefaction6" placeholder="6度时液化程度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="7度时液化程度" prop="liquefaction7">
            <el-col :span="19">
                <el-input v-model="wBangForm.liquefaction7" placeholder="7度时液化程度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="8度时液化程度" prop="liquefaction8">
            <el-col :span="19">
                <el-input v-model="wBangForm.liquefaction8" placeholder="8度时液化程度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="9度时液化程度" prop="liquefaction9">
            <el-col :span="19">
                <el-input v-model="wBangForm.liquefaction9" placeholder="9度时液化程度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="6度时震陷程度" prop="seismicsubsidence6">
            <el-col :span="19">
                <el-input v-model="wBangForm.seismicsubsidence6" placeholder="6度时震陷程度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="7度时震陷程度" prop="seismicsubsidence7">
            <el-col :span="19">
                <el-input v-model="wBangForm.seismicsubsidence7" placeholder="7度时震陷程度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="8度时震陷程度" prop="seismicsubsidence8">
            <el-col :span="19">
                <el-input v-model="wBangForm.seismicsubsidence8" placeholder="8度时震陷程度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="9度时震陷程度" prop="seismicsubsidence9">
            <el-col :span="19">
                <el-input v-model="wBangForm.seismicsubsidence9" placeholder="9度时震陷程度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="建设年代" prop="year">
            <el-col :span="19">
                <el-input v-model="wBangForm.year" placeholder="建设年代"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="设防烈度" prop="intensity">
            <el-col :span="19">
                <el-input v-model="wBangForm.intensity" placeholder="设防烈度"
                          maxlength="20" autocomplete="off"></el-input>
            </el-col>
        </el-form-item>
        <el-form-item class="form-label" label="关联子任务" prop="sid" style="display: none">
            <el-input v-model="wBangForm.sid"
                      maxlength="20" autocomplete="off"/>
        </el-form-item>
    </el-form>
</template>

<script>
    import qs from 'qs';

    export default {
        name: "NewWaterBang",
        data() {
            return {
                wBangForm: {
                    id: '',
                    name: '',
                    longitude: '',
                    latitude: '',
                    bid: '',
                    buildingName: '',
                    type: '',
                    floors: '',
                    area: '',
                    material: '',
                    materialType: '',
                    site: '',
                    liquefaction6: '',
                    liquefaction7: '',
                    liquefaction8: '',
                    liquefaction9: '',
                    seismicsubsidence6: '',
                    seismicsubsidence7: '',
                    seismicsubsidence8: '',
                    seismicsubsidence9: '',
                    year: '',
                    intensity: '',
                    remark: '',
                    sid: ''
                },
                rules: {
                    name: [],
                    longitude: [],
                    latitude: [],
                    bid: [],
                    buildingName: [],
                    type: [],
                    floors: [],
                    area: [],
                    material: [],
                    materialType: [],
                    site: [],
                    liquefaction6: [],
                    liquefaction7: [],
                    liquefaction8: [],
                    liquefaction9: [],
                    seismicsubsidence6: [],
                    seismicsubsidence7: [],
                    seismicsubsidence8: [],
                    seismicsubsidence9: [],
                    year: [],
                    intensity: [],
                    remark: []
                }
            }
        },
        mounted() {
            if (this.id !== -1) {
                axios.post("/bjdzms/waterBangData/findById",
                    qs.stringify({
                        'id': this.id
                    })).then(res => {
                    this.wBangForm = res.data.datas;
                });
            }
        },
        props: {
            sid: {
                type: Number,
                default: -1
            },
            id: {
                type: Number,
                default: -1
            }
        },
        methods: {
            to(path) {
                this.$router.push({name: path});
            },
            submitForm() {
                if (this.id !== -1) {
                    this.wBangForm.id = this.id;
                    axios.post("/bjdzms/waterBangData/upd",
                        qs.stringify(this.wBangForm)
                    ).then(res => {
                        this.$emit('updateData');
                    });
                } else {
                    this.wBangForm.sid = this.sid;
                    axios.post("/bjdzms/waterBangData/add",
                        qs.stringify(this.wBangForm)
                    ).then(res => {
                        this.$emit('updateData');
                    });
                }
            }
        }
    }
</script>

<style>
    .el-upload-dragger {
        height: 40px !important;
    }
</style>

<style scoped>
    .el-header {
        background: #EBEBEB;
        color: #e5e9ef;
        font-size: 2em;
        line-height: 80px;
        border: 5px solid #EBEBEB;
    }

    .el-main {
        background: #fff;
    }

    .el-container {
        height: 100%;
    }

    .el-form-item {
        width: 610px;
    }
</style
